<!DOCTYPE html>
<html>
<head>
	<title>用户搜索</title>
	<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">
	<style type="text/css">
		body { margin: 20px auto 0 auto; }
	</style>
</head>
<body>
<form class="form-inline">
	<div class="form-group">
		<label for="exampleInputName2">昵称</label>
		<input type="text" class="form-control" name="nickname" placeholder="% 代表模糊搜索" value="{{ old('nickname') }}">
	</div>
	<button type="submit" class="btn btn-default">搜索</button>
</form>
@if(isset($error))
	<div class="alert alert-warning" role="alert">{{ $error }}</div>
@endif
@if(isset($users))
	<table class="table table-bordered">
		<tr>
			<th>头像</th>
			<th>用户名</th>
			<th>微信-ID</th>
			<th>APP-ID</th>
			<th>手机</th>
			<th>小妖币</th>
			<th>金币</th>
			<th>VIP</th>
			<th>下载APP</th>
			<th>绑定手机</th>
			<th>玩过游戏</th>
			<th>时间</th>
		</tr>
		@foreach($users as $user)
			<tr>
				<td>
					<a href="/admin_1427a/user?id={{ $user->id }}" ><img src="{{ $user->avatar }}" class="img-responsive" width="30" height="30" ></a>
				</td>
				<td><a href="/admin_1427a/user?id={{ $user->id }}" >{{ $user->nickname }}</a></td>
				<td>{{ $user->openid }}</td>
				<td>{{ $user->openid_app }}</td>
				<td>{{ $user->phone }}</td>
				<td>{{ $user->XYB }}</td>
				<td>{{ $user->JB }}</td>
				<td>
					@if($user->game_zghpt->level)
						√ <a href="javascript:;" data-id="{{ $user->id }}" class="J_cancel-vip">取消</a>
					@else
						✕
					@endif
				</td>
				<td>@if(($user->status&1)==1) √ @else ✕ @endif</td>
				<td>@if(($user->status&2)==2) √ @else ✕ @endif</td>
				<td>@if(($user->status&4)==4) √ @else ✕ @endif</td>
				<td>{{ $user->created_at }}</td>
			</tr>
		@endforeach
	</table>
@endif
<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
	$('.J_cancel-vip').click(function () {
	    var $this = $(this);
        if (confirm('你要取消该用户的VIP吗？')) {
            $.post('/admin_1427a/user_vip_cancel', {
                id: $this.data('id'),
                '_token': '{{ csrf_token() }}'
            }, function (data) {
                if (data.status == 'success') {
                    $this.parent().html('✕');
                }
            });
        }
    });
</script>
</body>
</html>